<?php

namespace App\Models;


use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Support\Facades\Auth as Authenticatable;

class users extends Authenticatable
{
    use HasFactory;

    protected $table = 'zfm_users';
    protected $fillable = ['username', 'password', 'email'];

    /**
     * @name wl
     * @function 验证用户名与密码是否一致
     * @param $username
     * @param $password
     * @return mixed
     */
    public function Authenticatable($username, $password)
    {
        $user = $this->where('username', $username)->first();
        if (!$user || !password_verify($password, $user->password))
            return $user;
    }


    /**
     * @function 用户与用户行为表的记录
     * @return mixed
     */
    public function interests()
    {
        return $this->belongsToMany(Bebaviour::class);
    }
}
